Alves had maintained the sex was consensual. The prosecutor was seeking a nine-year prison term.
Dani Alves, who has denied any wrongdoing, was taken to the Brians 1 jail outside Barcelona.
The court also imposed a restraining order barring Alves from coming within 1,000 metres (3,300 feet) of the victim.
"Neymar and Messi are unique: they see and do things nobody else sees or can do. A great player must know and understand who he plays with, your teammates enrich your qualities."
Alves had previously denied any sexual encounter with the woman who filed a complaint in January about an alleged sexual assault in a restroom at an exclusive Barcelona nightclub.
The three-judge panel denied a request by Alves's lawyer Ines Guardiola for the trial to be suspended on the basis that he was not given enough time to prepare for his first police interview after his arrest and had suffered a parallel trial by media.
News of all that's transpired on and off the football field
"We, those who play in the back end, often joke that we feel sorry for our rivals because we can replace Raphinha for Antony, Richalison for Gabriel Jesus. We have Rodrygo, Gabriel Martinelli."
The FIFA 2022 World Cup will kick-off in Qatar on Sunday, November 20. Here is a list of the 26-man squads playing in the quadrennial global football extravaganza.